// JavaScript Document

$("#C4863").attr("disabled", true);
$("#C4930").attr("disabled", true);
$("#BLOCK_C4862 input,#C4930").priceFormat({
    prefix: '',
    centsSeparator: '',
    thousandsSeparator: '.',
	centsLimit: 0
});

$("#BLOCK_C4862 input").blur(function(){
//console.log("Este:"+parseInt(this.value.replace(/\./g,'')));
prom=(parseInt($("input[name='C4862\\[2\\]']").val().replace(/\./g,''))+parseInt($("input[name='C4862\\[1\\]']").val().replace(/\./g,''))+parseInt($("input[name='C4862\\[0\\]']").val().replace(/\./g,'')))/3;
$("#C4930").val(parseInt(prom));
$("#C4930").trigger("keyup");
//--DEFINICION DE SECTOR DE ACTIVIDAD (idpreg4872)
switch($("#C4872").val()){

    case '1':
		if(prom <= 18240000) $("#C4863").selectOptions('3'); 
		if(prom <= 3040000) $("#C4863").selectOptions('2'); 
		if(prom <= 456000) $("#C4863").selectOptions('1');
		if(prom > 18240000) $("#C4863").selectOptions('4');
	break;

	case '2': 		
	
		if(prom <= 60000000) $("#C4863").selectOptions('3');
		if(prom <= 7500000) $("#C4863").selectOptions('2'); 
		if(prom <= 1250000) $("#C4863").selectOptions('1');		
		if(prom >  60000000) $("#C4863").selectOptions('4');     
	break;

	case '3': 

		if(prom <= 88800000) $("#C4863").selectOptions('3'); 
		if(prom <= 11100000) $("#C4863").selectOptions('2'); 
 	    if(prom <= 1850000) $("#C4863").selectOptions('1');
		if(prom >  88800000  ) $("#C4863").selectOptions('4');
	break;

	case '4': 
		if(prom <= 22440000  ) $("#C4863").selectOptions('3'); 
		if(prom <= 3366000   ) $("#C4863").selectOptions('2'); 
		if(prom <= 467500    ) $("#C4863").selectOptions('1');
		if(prom >  22440000  ) $("#C4863").selectOptions('4'); 
	break;

	case '5':

		if(prom <= 24000000  ) $("#C4863").selectOptions('3');
		if(prom <= 3000000   ) $("#C4863").selectOptions('2'); 
		if(prom <= 480000    ) $("#C4863").selectOptions('1');		
		if(prom >  24000000  ) $("#C4863").selectOptions('4'); 
	break;

	default:
	$("#C4863").selectOptions('5');
	}


 

//alert($("input[name='"+control+"']:checked").val());

});
